At work we are constantly writing code, writing JavaScript, very little time for conceptual research. I have nothing to do today, I studied the relationship between "null" and "0". I hope you have seen the end of the harvest.
Alert (null>=0)
What does the above code pop up? False? True? is actually true. So why is it
I have nothing to do today. I have studied the relationship between "null" and "0. I hope you will get something better after reading it. I hope you will also enjoy the benefits of writing code without stopping, writing JavaScript, and very little time for conceptual research. I am not busy today. I have studied the relationship between "null" and "0. I hope you will get some results after reading this arti
In our lives, we are constantly writing code, writing JavaScript, and seldom have time to do conceptual research. I am not busy today. I have studied the relationship between "null" and "0. I hope you will get some results after reading this article.Copy codeThe Code is as follows:Alert (null> = 0) Copy codeThe Code is as follows:What will pop up in the above Code? False?
In our lives we keep writing code, writing JavaScript, and have little time for conceptual research. I have nothing to do today, I studied the relationship between "null" and "0". I hope you have seen the end of the harvest.
Copy Code code as follows:
Alert (null>=0)
Copy Code code as follows:
What does the above code pop up? False?
1 DOCTYPE HTML>2 HTML>3 Head>4 Metahttp-equiv= "Content-type"content= "text/html; charset=utf-8">5 title>Untitled Documenttitle>6 Script>7 vara=0;8 9 if(a) {Ten Alert ('I really do.') One } A Script> - Head> - the Body> - Body> - HTML>If the condition followed by the IF is a Boolean value, True and False (false), and the Boolean value is False, there is a a=0;a=undifine;a=none in the ca
I'd like to use Ajax for all the usual code like this:But what is the meaning of void (0) here?In JavaScript, Void is an operator that specifies that an expression is evaluated but does not return a value.The void operator uses the following format:1. javascript:void (expression)2. Javascript:void expressionExpression is a standard of Javascript to evaluate. Parentheses on the outside of the expression are optional, but writing is a good habit. (Imple
The result of non-null str0 is true.
Here bool is true .....
Why?
Reply to discussion (solution)
You do
Or
Check the results and analyze them by yourself.
You do
Or
Check the results and analyze them by yourself.
But isn't 0 a null string in php?
Upstairs I analyzed it like this. Echo $ str>
In recent projects, a field is encountered that is "enabled" if the value is 0,1 when the query is not writtenif isset ($args _array[' USEFLG ']) ! Empty ($args _array[' USEFLG '])) {..... }So I did not find the time for 0, think about it, should be 0 is considered empty. This should be the case:if isset ($args _arrayin_array($args _arrayarray(0,1))) {... }Read the PHP manual, Memo:If var the value is non-n
$num = 0;if($num == 'hello'){ echo $num; // echo 0}
Reply content:
$num = 0;if($num == 'hello'){ echo $num; // echo 0}
Check the official website: PHP Type comparison table
Specific reasons, there are also instructions
Update 2015-12-10 09:54:28
Read your comments, I think it is necessary to update.
You m
default anchor is #top, which is the upper end of the page and javascript:void (0) only represents a dead link That's why there are times when the page is very long browse the link is obviously # Yes Jumping to the top of the page and javascript:void (0) is not so So it's best to use void when calling scripts (0) or Several ways to link 1.window.open (' url ')
Here bool actually is true .....
This is why
Reply to discussion (solution)
You so
Or
Look at the results, and then analyze it yourself.
You so
Or
Look at the results, and then analyze it yourself.
But does the OP 0 in PHP represent an empty string?
Like upstairsThat's how I analyze it.echo $str > 0 results nullecho $STR ech
This code is common to everyone:But what is the meaning of void (0) here?The void in JavaScript is an operator,This operator specifies that an expression is to be evaluated but does not return a value。The void operator uses the following format:1. javascript:void (expression)2. Javascript:void expressionExpression is a standard of Javascript to evaluate. Parentheses on the outside of the expression are optional, but writing is a good habit. (Implement
In JavaScript, Void is an operator that specifies that an expression is evaluated but does not return a value.
The code that I want to use for Ajax is common:
Copy Code code as follows:
But what does void (0) mean here?
void operator usage format is as follows:
1. javascript:void (expression)
2. Javascript:void expression
Expression is an expression of the Javascript standard to compute. The parentheses on the outer side
in PHP$a = ' 0 ';$b = (bool) $a;Var_dump ($a);//Output FalseIn JS, the official description:Note:if The value parameter is omitted, or was 0, 0, NULL,, False, undefined, or NaN, the object is set to False.Otherwise It is set to true (even with the string false)!Test: value is true.PHP face TestOriginal: Reprint to htt
Boolean expressionAn expression with a value of true or false . Non-Boolean expressions can also be converted to a Boolean value if desired, but the following rules are followed:
All objects are treated as true.
The string is treated as false when and only if the string is empty.
null and undefined are treated as false.
When and only if the number is zero, the number is treated as false.
In
Boolean expressionAn expression with a value of true or false . Non-Boolean expressions can also be converted to a Boolean value if desired, but the following rules are followed:
All objects are treated as true.
The string is treated as false when and only if the string is empty.
null and undefined are treated as false.
When and only if the number is zero, the number is treated as false.
In
$test 01= "Hello" if ($test 01==0) {echo "true"}else{echo "false"} The result of the output is truePHP in judging the different types of time, you must use = = = to compareWhen comparing different types of variables, PHP has an internal mechanism to convert and then compare them.$test 01 = = 0It should be to convert $test01 into an integer and then compare, so the result is true.If you are not familiar with
True in Python and 1 and false and 0 can be compared in equivalentThe test is as follows:[email protected] root]# cat test_true_false.pyOk=0If OK:Print OKOk=1If OK:Print OKOk=trueIf OK:Print OKOk=falseIf OK:Print OKprint ' * ' *20Ok=0If ok = = False:Print OKOk=1If ok = = True:Print OKOk=falseIf OK ==0:Print OKOk=trueIf ok = = 1:Print OK[Email protected] root]#[em
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.